import { ref } from 'vue';

const countries = ref([
    { name: 'Argentina', code: 'AR', languages: [{ code: 'es', name: 'Spanish' }], minAge: 18 },
    { name: 'Australia', code: 'AU', languages: [{ code: 'en', name: 'English' }], minAge: 18 },
    { name: 'Austria', code: 'AT', languages: [{ code: 'de', name: 'German' }], minAge: 16 },
    { name: 'Belgium', code: 'BE', languages: [{ code: 'fr', name: 'French' }, { code: 'nl', name: 'Dutch (Flemish)' }], minAge: 16 },
    { name: 'Brazil', code: 'BR', languages: [{ code: 'pt', name: 'Portuguese' }], minAge: 18 },
    { name: 'Bulgaria', code: 'BG', languages: [{ code: 'bg', name: 'Bulgarian' }], minAge: 18 },
    { name: 'Canada', code: 'CA', languages: [{ code: 'en', name: 'English' }, { code: 'fr', name: 'French' }], minAge: 19 },
    { name: 'Chile', code: 'CL', languages: [{ code: 'es', name: 'Spanish' }], minAge: 18 },
    { name: 'China', code: 'CN', languages: [{ code: 'zh', name: 'Chinese' }], minAge: 18 },
    { name: 'Colombia', code: 'CO', languages: [{ code: 'es', name: 'Spanish' }], minAge: 18 },
    { name: 'Costa Rica', code: 'CR', languages: [{ code: 'es', name: 'Spanish' }], minAge: 18 },
    { name: 'Croatia (Hrvatska)', code: 'HR', languages: [{ code: 'hr', name: 'Croatian' }], minAge: 18 },
    { name: 'Czech Republic', code: 'CZ', languages: [{ code: 'cs', name: 'Czech' }], minAge: 16 },
    { name: 'Denmark', code: 'DK', languages: [{ code: 'da', name: 'Danish' }], minAge: 16 },
    { name: 'Dominican Republic', code: 'DO', languages: [{ code: 'es', name: 'Spanish' }], minAge: 18 },
    { name: 'Ecuador', code: 'EC', languages: [{ code: 'es', name: 'Spanish' }], minAge: 18 },
    { name: 'Egypt', code: 'EG', languages: [{ code: 'ar', name: 'Arabic' }, { code: 'en', name: 'English' }], minAge: 18 },
    { name: 'Estonia', code: 'EE', languages: [{ code: 'et', name: 'Estonian' }], minAge: 18 },
    { name: 'Finland', code: 'FI', languages: [{ code: 'fi', name: 'Finnish' }], minAge: 16 },
    { name: 'France', code: 'FR', languages: [{ code: 'fr', name: 'French' }], minAge: 16 },
    { name: 'Germany', code: 'DE', languages: [{ code: 'de', name: 'German' }], minAge: 16 },
    { name: 'Great Britain (UK)', code: 'GB', languages: [{ code: 'en', name: 'English' }], minAge: 16 },
    { name: 'Greece', code: 'GR', languages: [{ code: 'el', name: 'Greek' }], minAge: 16 },
    { name: 'Guatemala', code: 'GT', languages: [{ code: 'es', name: 'Spanish' }], minAge: 18 },
    { name: 'Hong Kong', code: 'HK', languages: [{ code: 'en', name: 'English' }, { code: 'zh', name: 'Chinese' }], minAge: 18 },
    { name: 'Hungary', code: 'HU', languages: [{ code: 'hu', name: 'Hungarian' }], minAge: 16 },
    { name: 'India', code: 'IN', languages: [{ code: 'bn', name: 'Bengali' }, { code: 'en', name: 'English' }, { code: 'hi', name: 'Hindi' }, { code: 'kn', name: 'Kannada' }, { code: 'mr', name: 'Marathi' }, { code: 'ta', name: 'Tamil' }], minAge: 18 },
    { name: 'Indonesia', code: 'ID', languages: [{ code: 'id', name: 'Indonesian' }], minAge: 15 },
    { name: 'Ireland', code: 'IE', languages: [{ code: 'en', name: 'English' }], minAge: 16 },
    { name: 'Israel', code: 'IL', languages: [{ code: 'en', name: 'English' }, { code: 'he', name: 'Hebrew' }], minAge: 18 },
    { name: 'Italy', code: 'IT', languages: [{ code: 'it', name: 'Italian' }], minAge: 16 },
    { name: 'Japan', code: 'JP', languages: [{ code: 'ja', name: 'Japanese' }], minAge: 18 },
    { name: 'Kenya', code: 'KE', languages: [{ code: 'en', name: 'English' }, { code: 'sw', name: 'Swahili' }], minAge: 18 },
    { name: 'Korea (South)', code: 'KR', languages: [{ code: 'ko', name: 'Korean' }], minAge: 19 },
    { name: 'Latvia', code: 'LV', languages: [{ code: 'lv', name: 'Latvian' }], minAge: 18 },
    { name: 'Lithuania', code: 'LT', languages: [{ code: 'lt', name: 'Lithuanian' }], minAge: 18 },
    { name: 'Luxembourg', code: 'LU', languages: [{ code: 'de', name: 'German' }], minAge: 18 },
    { name: 'Malaysia', code: 'MY', languages: [{ code: 'en', name: 'English' }, { code: 'ms', name: 'Malay' }], minAge: 18 },
    { name: 'Mexico', code: 'MX', languages: [{ code: 'es', name: 'Spanish' }], minAge: 18 },
    { name: 'Morocco', code: 'MA', languages: [{ code: 'ar', name: 'Arabic' }, { code: 'fr', name: 'French' }], minAge: 18 },
    { name: 'Netherlands', code: 'NL', languages: [{ code: 'nl', name: 'Dutch (Flemish)' }], minAge: 16 },
    { name: 'New Zealand (Aotearoa)', code: 'NZ', languages: [{ code: 'en', name: 'English' }], minAge: 18 },
    { name: 'Nigeria', code: 'NG', languages: [{ code: 'en', name: 'English' }], minAge: 18 },
    { name: 'Norway', code: 'NO', languages: [{ code: 'nb', name: 'Norwegian (Norsk)' }], minAge: 16 },
    { name: 'Panama', code: 'PA', languages: [{ code: 'es', name: 'Spanish' }], minAge: 18 },
    { name: 'Philippines', code: 'PH', languages: [{ code: 'en', name: 'English' }], minAge: 18 },
    { name: 'Poland', code: 'PL', languages: [{ code: 'pl', name: 'Polish' }], minAge: 16 },
    { name: 'Portugal', code: 'PT', languages: [{ code: 'pt', name: 'Portuguese' }], minAge: 16 },
    { name: 'Qatar', code: 'QA', languages: [{ code: 'ar', name: 'Arabic' }, { code: 'en', name: 'English' }], minAge: 18 },
    { name: 'Romania', code: 'RO', languages: [{ code: 'ro', name: 'Romanian' }], minAge: 18 },
    { name: 'Saudi Arabia', code: 'SA', languages: [{ code: 'en', name: 'English' }, { code: 'ar', name: 'Arabic' }], minAge: 15 },
    { name: 'Serbia', code: 'RS', languages: [{ code: 'sr', name: 'Serbian' }], minAge: 18 },
    { name: 'Singapore', code: 'SG', languages: [{ code: 'en', name: 'English' }, { code: 'zh', name: 'Chinese' }], minAge: 21 },
    { name: 'Slovak Republic', code: 'SK', languages: [{ code: 'sk', name: 'Slovak' }], minAge: 18 },
    { name: 'Slovenia', code: 'SI', languages: [{ code: 'sl', name: 'Slovenian' }], minAge: 18 },
    { name: 'South Africa', code: 'ZA', languages: [{ code: 'af', name: 'Afrikaans' }, { code: 'en', name: 'English' }], minAge: 18 },
    { name: 'Spain', code: 'ES', languages: [{ code: 'es', name: 'Spanish' }], minAge: 16 },
    { name: 'Sweden', code: 'SE', languages: [{ code: 'sv', name: 'Swedish' }], minAge: 16 },
    { name: 'Switzerland', code: 'CH', languages: [{ code: 'de', name: 'German' }, { code: 'fr', name: 'French' }, { code: 'it', name: 'Italian' }], minAge: 16 },
    { name: 'Taiwan', code: 'TW', languages: [{ code: 'zh', name: 'Chinese' }], minAge: 20 },
    { name: 'Thailand', code: 'TH', languages: [{ code: 'th', name: 'Thai' }], minAge: 20 },
    { name: 'Turkey', code: 'TR', languages: [{ code: 'tr', name: 'Turkish' }], minAge: 18 },
    { name: 'United Arab Emirates', code: 'AE', languages: [{ code: 'ar', name: 'Arabic' }, { code: 'en', name: 'English' }], minAge: 21 },
    { name: 'United States', code: 'US', languages: [{ code: 'en', name: 'English' }, { code: 'es', name: 'Spanish' }], minAge: 17 },
    { name: 'Uruguay', code: 'UY', languages: [{ code: 'es', name: 'Spanish' }], minAge: 18 },
    { name: 'Viet Nam', code: 'VN', languages: [{ code: 'vi', name: 'Vietnamese' }], minAge: 16 }
]);

// 从countries数组中提取所有语言并去重
const allLanguages = [...new Set(
  countries.value.flatMap(country => 
    country.languages.map(lang => lang.name)
  )
)].sort();

export { countries, allLanguages };